#ifndef INCLUDES_DATATYPE_H
#define INCLUDES_DATATYPE_H 1

#include <common/macro/build.h>
#include <common/common.h>
#include <common/predicate.h>

typedef int(*datatype_verify_f)(void *, char *, size_t);

typedef void*(*datatype_arguments_parse_f)(char **, size_t);
typedef void (*datatype_arguments_destroy_f)(void *);

typedef struct datatype_t {
	char *name;

	int minargs, maxargs;
	datatype_arguments_parse_f args_parse;
	datatype_arguments_destroy_f args_destroy;

	datatype_verify_f verify;	
	generic_dealloc_f destroy;

	predicate_t *predicates;
} datatype_t;

API_LIBLOCAL predicate_t *datatype_predicate_lookup(datatype_t *, const char *);
API_LIBLOCAL datatype_t *datatype_lookup(const char *);

#endif
